package com.example.a2207_zh

import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.viewModelScope
import com.example.a2207_zh.entity.RoomEntityResult
import com.example.a2207_zh.mvvm.BaseViewModel
import com.example.a2207_zh.net.ApiServer
import kotlinx.coroutines.launch

class FangViewModel:BaseViewModel() {
    val success = MutableLiveData<RoomEntityResult>()
    val fail = MutableLiveData<String>()

    fun room(){
        viewModelScope.launch {
            try {
                success.value = apiServer.room()
            }catch (e:Exception){
                fail.value = e.message
            }
        }
    }
}